<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .public-event, .public-event .fc-event-skin, .public-event a {
                background-color: green;
                color: black;
                border-color: greenyellow;
            }
        </style>
        <script language="JavaScript" type="text/JavaScript">
            //<![CDATA[
            function showAlert() {
                fundpickerdialog = jQuery('#modalAlert').modal({
                    opacity:100,
                    overlayCss:{backgroundColor:"#fff"},
                    modal:true,
                    dataId:'modalAlert',
                    classname:'ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable',
                    closeOnEscape:false,
                    width:50,
                    height:50
                });
            }

            function handleProject(){
                var taskType = jQuery("input[name='tabview:mainform:taskType']:checked").val();
                if (taskType == 'AUDITLIST'){
                    jQuery('[id="tabview:mainform:taskProjLabel"]').show();
                    jQuery('[id="tabview:mainform:taskProj"]').show();
                }else{
                    jQuery('[id="tabview:mainform:taskProjLabel"]').hide();
                    jQuery('[id="tabview:mainform:taskProj"]').hide();
                }
            }

            function KeyDown() {
                if (event.keyCode == 13) {
                    event.keyCode = 9;
                }
            }

            PrimeFaces.locales ['cn'] = {
                closeText:'关闭',
                prevText:'上月',
                nextText:'下月',
                monthNames:['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                monthNamesShort:['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                dayNames:['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesShort:['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin:['日', '一', '二', '三', '四', '五', '六'],
                weekHeader:'周',
//                firstDay: #{PlanningCalendarFacadeBean.getFirstDay()},
                firstDay:1,
                isRTL:false,
                showMonthAfterYear:false,
                yearSuffix:'',
                timeOnlyTitle:'选择时间',
                timeText:'时间',
                hourText:'小时',
                minuteText:'分钟',
                secondText:'秒',
                currentText:'今天',
                ampm:false,
                month:'月',
                week:'周',
                day:'日',
                allDayText:'全天'
            };
            //]]>
        </script>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px">
            <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
                <p:tab title="个人日志管理">
                    <h:form id="mainform">
                        <div id="qrytable">
                            <p:ajaxStatus style="height:18px;text-align:center">
                                <f:facet name="start">
                                    <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                                </f:facet>
                                <f:facet name="complete">
                                    <h:outputText value=""/>
                                </f:facet>
                            </p:ajaxStatus>
                            <p:growl id="messages" showDetail="true"/>
                            <p:schedule value="#{scheduleAction.eventModel}"
                                        widgetVar="myschedule"
                                        timeFormat="yyyy/MM/dd"
                                        locale="cn">
                                <p:ajax event="dateSelect" listener="#{scheduleAction.onDateSelect}"
                                        update="eventTypes eventDetails" oncomplete="eventDialog.show()"/>
                                <p:ajax event="eventSelect" listener="#{scheduleAction.onEventSelect}"
                                        update="eventTypes eventDetails" oncomplete="handleProject();eventDialog.show()"/>
                                <p:ajax event="eventMove" listener="#{scheduleAction.onEventMove}"
                                        update="messages"/>
                                <p:ajax event="eventResize" listener="#{scheduleAction.onEventResize}"
                                        update="messages"/>
                            </p:schedule>

                            <p:dialog widgetVar="eventDialog" header="工作事项" modal="true"
                                       hideEffect="clip">
                                <h:panelGrid id="eventTypes" columns="2" cellpadding="5"
                                             style="margin-left: 20px; margin-top:15px; margin-right:40px">
                                    <h:outputLabel for="taskType" value="工作类型:" style="font-weight: bold;"/>
                                    <h:selectOneRadio id="taskType" value="#{scheduleAction.event.taskType}">
                                        <f:selectItems value="#{scheduleAction.taskTypes}"/>
                                        <p:ajax update="taskItem taskProjLabel taskProj" listener="#{scheduleAction.handleTaskTypeChange}" oncomplete="handleProject()"/>
                                    </h:selectOneRadio>
                                </h:panelGrid>
                                <p:separator/>
                                <h:panelGrid id="eventDetails" columns="2" cellpadding="5"
                                             style="margin-left: 20px; margin-top:15px; margin-right:40px; margin-bottom: 15px">
                                    <h:outputLabel id="taskProjLabel" for="taskProj" value="审计项目:" style="font-weight: bold;"/>
                                    <p:selectOneMenu id="taskProj" value="#{scheduleAction.event.prjid}">
                                        <f:selectItems value="#{scheduleAction.projects}"/>
                                    </p:selectOneMenu>
                                    <h:outputLabel for="taskItem" value="工作事项:" style="font-weight: bold;"/>
                                    <p:selectOneMenu id="taskItem" value="#{scheduleAction.event.taskItem}">
                                        <f:selectItems value="#{scheduleAction.taskItems}"/>
                                    </p:selectOneMenu>
                                    <h:outputLabel for="from" value="起始日期:" style="font-weight: bold;"/>
                                    <p:inputText id="from" value="#{scheduleAction.event.startDate}">
                                    <f:convertDateTime pattern="yyyy/MM/dd HH:mm"/>
                                    </p:inputText>
                                    <h:outputLabel for="to" value="结束日期:" style="font-weight: bold;"/>
                                    <p:inputText id="to" value="#{scheduleAction.event.endDate}" >
                                        <f:convertDateTime pattern="yyyy/MM/dd HH:mm"/>
                                    </p:inputText>
                                    <h:outputLabel for="allDay" value="是否全天事项:" style="font-weight: bold;"/>
                                    <h:selectBooleanCheckbox id="allDay" value="#{scheduleAction.event.allDay}"/>
                                </h:panelGrid>
                                <p:separator/>
                                <h:panelGrid id="button" columns="2" style="float: right;margin-top: 10px; margin-bottom: 10px">
                                    <p:commandButton value="   保 存  " style="width:80px"
                                                     actionListener="#{scheduleAction.addEvent}"
                                                     oncomplete="myschedule.update();eventDialog.hide();"/>
                                    <p:commandButton value="   删 除  " style="width:80px" rendered="#{!scheduleAction.newEvent}"
                                                     actionListener="#{scheduleAction.deleteEvent}"
                                                     oncomplete="myschedule.update();eventDialog.hide();"/>
                                </h:panelGrid>
                            </p:dialog>
                        </div>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>